99 improve pc builder reliability and user feedback #122
+1,768
−39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
The PC builder loaded saved builds from
localStoragewithout validating them, treated missing component prices as zero without telling the user, and showed several unnecessary "Unknown" compatibility messages for an empty build. This PR makes the builder more reliable and clearer in those cases.Changes
idandname, its price isnullor a non-negative number, anddetailsis an object. Invalid parts are dropped and valid ones are kept. Broken JSON and values that are not an object still give an empty build, without crashing.BuildProvider.test.tsxfor the full part shape and the new validation.Related issues
Closes #99
Verification
(frontend):
npm test: all 89 tests pass.Manual testing (steps to run in the browser):
price_eurtonullinlocalStorageand reload: the summary shows the incomplete-total note and the slot shows "Price unavailable".Screenshots
Checklist